From e09c21cb7fee9339e49cdabd1daec665608918bf Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sun, 19 Mar 2006 13:13:35 +0100 Subject: [PATCH] Conditionalize building the Xen ACPI driver. Also introduces some cleanups to the Xen build system. Signed-off-by: Hollis Blanchard Signed-off-by: Keir Fraser --- xen/Post.mk | 15 ++++++++++++ xen/Rules.mk | 52 ++++++++++++++++++++++-------------------- xen/arch/ia64/Rules.mk | 1 + xen/arch/x86/Rules.mk | 2 ++ xen/drivers/Makefile | 10 ++++---- 5 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 xen/Post.mk diff --git a/xen/Post.mk b/xen/Post.mk new file mode 100644 index 0000000000..e765893760 --- /dev/null +++ b/xen/Post.mk @@ -0,0 +1,15 @@ + +subdirs-all := $(subdirs-y) $(subdirs-n) + +default: $(subdirs-y) + +.PHONY: FORCE +FORCE: + +%/: FORCE + $(MAKE) -C $* + +clean: $(addprefix _clean_, $(subdirs-all)) +_clean_%/: FORCE + $(MAKE) -C $* clean + diff --git a/xen/Rules.mk b/xen/Rules.mk index 2ece51a889..ce51931923 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -8,6 +8,15 @@ perfc ?= n perfc_arrays?= n crash_debug ?= n +# Hardcoded configuration implications and dependencies. +# Do this is a neater way if it becomes unwieldy. +ifeq ($(debug),y) +verbose := y +endif +ifeq ($(perfc_arrays),y) +perfc := y +endif + XEN_ROOT=$(BASEDIR)/.. include $(XEN_ROOT)/Config.mk @@ -32,36 +41,29 @@ S_SRCS := $(wildcard *.S) OBJS := $(patsubst %.S,%.o,$(S_SRCS)) OBJS += $(patsubst %.c,%.o,$(C_SRCS)) -# Note that link order matters! -ALL_OBJS := $(BASEDIR)/common/common.o -ALL_OBJS += $(BASEDIR)/drivers/char/driver.o -ALL_OBJS += $(BASEDIR)/drivers/acpi/driver.o -ifeq ($(ACM_SECURITY),y) -ALL_OBJS += $(BASEDIR)/acm/acm.o -CFLAGS += -DACM_SECURITY -endif -ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o +ALL_OBJS-y := +CFLAGS-y := +subdirs-y := +subdirs-n := include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk -CFLAGS += -g -D__XEN__ - -ifneq ($(debug)$(verbose),nn) -CFLAGS += -DVERBOSE -endif - -ifeq ($(crash_debug),y) -CFLAGS += -DCRASH_DEBUG -endif +# Note that link order matters! +ALL_OBJS-y += $(BASEDIR)/common/common.o +ALL_OBJS-y += $(BASEDIR)/drivers/char/driver.o +ALL_OBJS-$(HAS_ACPI) += $(BASEDIR)/drivers/acpi/driver.o +ALL_OBJS-$(ACM_SECURITY) += $(BASEDIR)/acm/acm.o +ALL_OBJS-y += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o -ifeq ($(perfc),y) -CFLAGS += -DPERF_COUNTERS -ifeq ($(perfc_arrays),y) -CFLAGS += -DPERF_ARRAYS -endif -endif +CFLAGS-y += -g -D__XEN__ +CFLAGS-$(ACM_SECURITY) += -DACM_SECURITY +CFLAGS-$(verbose) += -DVERBOSE +CFLAGS-$(crash_debug) += -DCRASH_DEBUG +CFLAGS-$(perfc) += -DPERF_COUNTERS +CFLAGS-$(perfc_arrays) += -DPERF_ARRAYS -CFLAGS := $(strip $(CFLAGS)) +ALL_OBJS := $(ALL_OBJS-y) +CFLAGS := $(strip $(CFLAGS) $(CFLAGS-y)) %.o: %.c $(HDRS) Makefile $(CC) $(CFLAGS) -c $< -o $@ diff --git a/xen/arch/ia64/Rules.mk b/xen/arch/ia64/Rules.mk index 41d5e5e903..5ecaf67fd5 100644 --- a/xen/arch/ia64/Rules.mk +++ b/xen/arch/ia64/Rules.mk @@ -1,6 +1,7 @@ ######################################## # ia64-specific definitions +HAS_ACPI := y VALIDATE_VT ?= n ifneq ($(COMPILE_ARCH),$(TARGET_ARCH)) CROSS_COMPILE ?= /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux- diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk index 3921119034..a83b8b3a07 100644 --- a/xen/arch/x86/Rules.mk +++ b/xen/arch/x86/Rules.mk @@ -1,6 +1,8 @@ ######################################## # x86-specific definitions +HAS_ACPI := y + # # If you change any of these configuration options then you must # 'make clean' before rebuilding. diff --git a/xen/drivers/Makefile b/xen/drivers/Makefile index e0a67e5dc2..e118e2115a 100644 --- a/xen/drivers/Makefile +++ b/xen/drivers/Makefile @@ -1,8 +1,6 @@ +include $(BASEDIR)/Rules.mk -default: - $(MAKE) -C char - $(MAKE) -C acpi +subdirs-y := char/ +subdirs-$(HAS_ACPI) += acpi/ -clean: - $(MAKE) -C char clean - $(MAKE) -C acpi clean +include $(BASEDIR)/Post.mk -- 2.30.2